import http from "@/utils/http";
import {GW,YNGP} from "@/common/const";
/**
 * 搜索列表
 * @param {Object} option
 * @param {Number} option.content - 股东名称
 * @param {Number, Optional} option.holderType - 0-牛散,1-机构,非必传默认0
 * @param {Number, Optional} option.limit - 条数(非必传,默认4条)
 *
 * @return {Promise} Array
 */
export function getSearchList(option) {
  const url = `${GW}/gw/ynstockinfo/client/monitor/holder/search`;
  const params = {
    content: "",
    holderType: "",
    limit: "",
    ...option,
  };
  return http.get(url,params );
}

/**
 * 股东监控数据列表
 * @param {Object} option
 * @param {Number} option.moduleId - 模块id(1-牛散增持,2-机构增持,3-高管增持,4-大股东增持,5-股东人数)
 * @param {Number} option.holderName - 模块id为1/2时必传
 * @param {Number, Optional} option.type - 数据类型牛散增持(1-持有流通股/2-持有股份股/3-限售解禁),机构增持(1-持有流通股/2-持有股份股),高管增持/机构增持/股东人数(1/2/3/4/5-对应A股沪深等)具体参考原型上的顺序
 * @param {Number} option.pageNo - 当前页码
 * @param {Number} option.pageSize - 请求条数
 * @return {Promise} Array
 */
export function getDataList(option) {
  const url = `${GW}/gw/ynstockinfo/client/monitor/data/query`;
  const params = {
    moduleId: "",
    type: "",
    pageNo: "",
    pageSize: "",
    ...option,
  };
  return http.get(url,  params);
}

/**
 * 验证关注状态
 * @param {Object} option
 * @param {Number} option.token - token
 * @param {Number} option.holderType - 模块id(1-牛散增持,2-机构增持,3-高管增持,4-大股东增持,5-股东人数)
 * @param {Number} option.limit - 股东名称(如果模块id为1/2时,该参数必传)
 *
 * @return {Promise} Array
 */
export function checkfollow(option) {
  const url = `${GW}/gw/ynstockinfo/client/monitor/holder/checkfollow`;
  const params = {
    moduleId: "",
    ...option,
  };
  return http.get(url, params );
}

/**
 * 关注
 * @param {Object} option
 * @param {Number} option.token - token
 * @param {Number} option.holderType - 模块id(1-牛散增持,2-机构增持,3-高管增持,4-大股东增持,5-股东人数)
 * @param {Number} option.limit - 股东名称(如果模块id为1/2时,该参数必传)
 *
 * @return {Promise} Array
 */
export function follow(option) {
  const url = `${GW}/gw/ynstockinfo/client/monitor/holder/follow`;
  const params = {
    moduleId: "",
    ...option,
  };
  return http.get(url, params);
}

/**
 * 取消关注
 * @param {Object} option
 * @param {Number} option.token - token
 * @param {Number} option.holderType - 模块id(1-牛散增持,2-机构增持,3-高管增持,4-大股东增持,5-股东人数)
 * @param {Number} option.limit - 股东名称(如果模块id为1/2时,该参数必传)
 *
 * @return {Promise} Array
 */
export function unfollow(option) {
  const url = `${GW}/gw/ynstockinfo/client/monitor/holder/unfollow`;
  const params = {
    moduleId: "",
    ...option,
  };
  return http.get(url, params);
}
/**
 * 关注列表
 * @param {Object} option
 * @param {Number} option.token - token
 * @return {Promise} Array
 */
export function getFollowList(option) {
  const url = `${GW}/gw/ynstockinfo/client/monitor/follow/list`;
  const params = {
    ...option,
  };
  return http.get(url, params );
}

/**
 * 动态
 * @param {Object} option
 * @param {Number} option.token - token
 * @return {Promise} Array
 */
export function getDynamic(option) {
  const url = `${GW}/gw/ynstockinfo/client/monitor/follow/dynamic`;
  const params = {
    ...option,
  };
  return http.get(url, params );
}
/**
 * 行业名称
 * @return {Promise} Array
 */
export function blockList(option) {
  const url = `${GW}/gw/ynstockinfo/client/monitor/holder/blockNameList`;
  const params = {
    ...option,
  };
  return http.get(url, params);
}

